
// Copyright (C) 2007 Richard Uhler
// This file is part of Esiply.
//
// Esiply is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, Version 2,
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// This file contains the implementation for all the Error standard
// library stuff that can be implemented completely in javascript

Esiply.set_attributes(Error.prototype, "constructor", Esiply.DONT_ENUM);
Error.prototype.constructor = Error;

Esiply.set_attributes(Error.prototype, "name", Esiply.DONT_ENUM);
Error.prototype.name = "Error";

Esiply.set_attributes(Error.prototype, "message", Esiply.DONT_ENUM);
Error.prototype.message = "An Error as occured";

Esiply.set_attributes(EvalError.prototype, "constructor", Esiply.DONT_ENUM);
EvalError.prototype.constructor = EvalError;

Esiply.set_attributes(EvalError.prototype, "name", Esiply.DONT_ENUM);
EvalError.prototype.name = "EvalError";

Esiply.set_attributes(EvalError.prototype, "message", Esiply.DONT_ENUM);
EvalError.prototype.message = "An EvalError as occured";

Esiply.set_attributes(RangeError.prototype, "constructor", Esiply.DONT_ENUM);
RangeError.prototype.constructor = RangeError;

Esiply.set_attributes(RangeError.prototype, "name", Esiply.DONT_ENUM);
RangeError.prototype.name = "RangeError";

Esiply.set_attributes(RangeError.prototype, "message", Esiply.DONT_ENUM);
RangeError.prototype.message = "A RangeError as occured";

Esiply.set_attributes(ReferenceError.prototype, "constructor", Esiply.DONT_ENUM);
ReferenceError.prototype.constructor = ReferenceError;

Esiply.set_attributes(ReferenceError.prototype, "name", Esiply.DONT_ENUM);
ReferenceError.prototype.name = "ReferenceError";

Esiply.set_attributes(ReferenceError.prototype, "message", Esiply.DONT_ENUM);
ReferenceError.prototype.message = "A ReferenceError as occured";

Esiply.set_attributes(SyntaxError.prototype, "constructor", Esiply.DONT_ENUM);
SyntaxError.prototype.constructor = SyntaxError;

Esiply.set_attributes(SyntaxError.prototype, "name", Esiply.DONT_ENUM);
SyntaxError.prototype.name = "SyntaxError";

Esiply.set_attributes(SyntaxError.prototype, "message", Esiply.DONT_ENUM);
SyntaxError.prototype.message = "A SyntaxError as occured";

Esiply.set_attributes(TypeError.prototype, "constructor", Esiply.DONT_ENUM);
TypeError.prototype.constructor = TypeError;

Esiply.set_attributes(TypeError.prototype, "name", Esiply.DONT_ENUM);
TypeError.prototype.name = "TypeError";

Esiply.set_attributes(TypeError.prototype, "message", Esiply.DONT_ENUM);
TypeError.prototype.message = "A TypeError as occured";

Esiply.set_attributes(URIError.prototype, "constructor", Esiply.DONT_ENUM);
URIError.prototype.constructor = URIError;

Esiply.set_attributes(URIError.prototype, "name", Esiply.DONT_ENUM);
URIError.prototype.name = "URIError";

Esiply.set_attributes(URIError.prototype, "message", Esiply.DONT_ENUM);
URIError.prototype.message = "A URIError as occured";

// Ecma 15.11.4.4 Error.prototype.toString()
// Returns an implementation defined string
Esiply.set_attributes(Error.prototype, "toString", Esiply.DONT_ENUM);
Error.prototype.toString = function()
{
    return this.name + ": " + this.message;
};

